QuickDraw 3D provides routines that you can use to manage bounding spheres.
You can use the Q3BoundingSphere_Copy function to make a copy of a bounding sphere.
TQ3BoundingSphere *Q3BoundingSphere_Copy (
const TQ3BoundingSphere *src,
TQ3BoundingSphere *dest);
The Q3BoundingSphere_Copy function returns, as its function result and in the dest parameter, a copy of the bounding sphere specified by the src parameter. Q3BoundingSphere_Copy does not allocate any memory for the destination bounding sphere; the dest parameter must point to space allocated in the heap or on the stack before you call Q3BoundingSphere_Copy .
You can use the Q3BoundingSphere_Union function to find the union of two bounding spheres.
TQ3BoundingSphere *Q3BoundingSphere_Union (
const TQ3BoundingSphere *s1,
const TQ3BoundingSphere *s2,
TQ3BoundingSphere *result);
The Q3BoundingSphere_Union function returns, as its function result and in the result parameter, a pointer to the bounding sphere that is the union of the two bounding spheres specified by the parameters s1 and s2 . The result parameter can point to the memory occupied by either s1 or s2 , thereby performing the union operation in place.
You can use the Q3BoundingSphere_Set function to set the defining origin and radius of a bounding sphere.
TQ3BoundingSphere *Q3BoundingSphere_Set (
TQ3BoundingSphere *bSphere,
const TQ3Point3D *origin,
float radius,
TQ3Boolean isEmpty);
You can use the Q3BoundingSphere_UnionPoint3D function to find the union of a bounding sphere and a three-dimensional point.
TQ3BoundingSphere *Q3BoundingSphere_UnionPoint3D (
const TQ3BoundingSphere *bSphere,
const TQ3Point3D *pt3D,
TQ3BoundingSphere *result);
The Q3BoundingSphere_UnionPoint3D function returns, as its function result and in the result parameter, a pointer to the bounding sphere that is the union of the bounding sphere specified by the bSphere parameter and the three-dimensional point specified by the pt3D parameter. The result parameter can point to the memory pointed to by bSphere , thereby performing the union operation in place.
You can use the Q3BoundingSphere_UnionRationalPoint4D function to find the union of a bounding sphere and a rational four-dimensional point.
TQ3BoundingSphere *Q3BoundingSphere_UnionRationalPoint4D (
const TQ3BoundingSphere *bSphere,
const TQ3RationalPoint4D *pt4D,
TQ3BoundingSphere *result);
The Q3BoundingSphere_UnionRationalPoint4D function returns, as its function result and in the result parameter, a pointer to the bounding sphere that is the union of the bounding sphere specified by the bSphere parameter and the rational four-dimensional point specified by the pt4D parameter. The result parameter can point to the memory pointed to by bSphere , thereby performing the union operation in place.
You can use the Q3BoundingSphere_SetFromPoints3D function to find the bounding sphere that bounds an arbitrary list of three-dimensional points.
TQ3BoundingSphere *Q3BoundingSphere_SetFromPoints3D (
TQ3BoundingSphere *bSphere,
const TQ3Point3D *pts,
unsigned long nPts,
unsigned long structSize);
The Q3BoundingSphere_SetFromPoints3D function returns, as its function result and in the bSphere parameter, a pointer to a bounding sphere that contains all the points in the list of three-dimensional points specified by the pts parameter. The nPts parameter indicates how many points are in that list, and the structSize parameter indicates the offset between any two successive points in the list. By suitably specifying the value of the structSize parameter, you can have QuickDraw 3D extract points that are embedded in an array of larger data structures.
You can use the Q3BoundingSphere_SetFromRationalPoints4D function to find the bounding sphere that bounds an arbitrary list of rational four-dimensional points.
TQ3BoundingSphere *Q3BoundingSphere_SetFromRationalPoints4D (
TQ3BoundingSphere *bSphere,
const TQ3RationalPoint4D *pts,
unsigned long nPts,
unsigned long structSize);
The Q3BoundingSphere_SetFromRationalPoints4D function returns, as its function result and in the bSphere parameter, a pointer to a bounding sphere that contains all the points in the list of rational four-dimensional points specified by the pts parameter. The nPts parameter indicates how many points are in that list, and the structSize parameter indicates the offset between any two successive points in the list. By suitably specifying the value of the structSize parameter, you can have QuickDraw 3D extract points that are embedded in an array of larger data structures.